package com.esms.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.esms.dao.EmployeeMapper;
import com.esms.dao.XevaluationMapper;
import com.esms.po.Employee;
import com.esms.po.Tassessment;
import com.esms.po.Xevaluation;
import com.esms.service.IEmployeeXevaluationServer;

@Service
public class EmployeeXevaluationServerImpl implements IEmployeeXevaluationServer {
	@Autowired
    private XevaluationMapper xevaluationMapper = null;
	@Autowired
    private EmployeeMapper employeeMapper = null;
	
    @Override
	public List<Xevaluation> getEmployeeXevaluationList(int eId, String fEid) {
    	Employee employee = employeeMapper.selectByPrimaryKey(eId);
		String e_account = employee.geteAccount();
		if ("0".equals(fEid)) {
			return xevaluationMapper.selectBypIdAnddId(e_account);
		} else {
			return xevaluationMapper.selectBypIdAnddIdAndfEid(fEid,e_account);
		}
	}
    
    @Override
    public int updateXevaluationList(Xevaluation xevaluation) {
         return  xevaluationMapper.updateBysId(xevaluation); 
    
    }
    
    @Override
    public int deleteXevaluation(String tAuserid , String tDuserid) {
         return  xevaluationMapper.deleteSevaluation(tAuserid, tDuserid);
    
    }
    
    @Override
    public int insertXevaluation(Tassessment tassessment) {
         return  xevaluationMapper.insertSevaluation(tassessment); 
    
    }
}
